package team.bluepen.supermarket.data.database.dao;

import space.lingu.light.*;
import team.bluepen.supermarket.data.entity.Product;
import team.bluepen.supermarket.data.entity.ProductIdAmount;

import java.util.List;

/**
 * @author RollW
 */
@Dao
public interface ProductIdAmountDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(ProductIdAmount... products);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(List<ProductIdAmount> products);

    @Update(onConflict = OnConflictStrategy.ABORT)
    void update(ProductIdAmount... products);

    @Update(onConflict = OnConflictStrategy.ABORT)
    void update(List<ProductIdAmount> products);

    @Delete
    void delete(ProductIdAmount Product);

    @Delete
    void delete(List<ProductIdAmount> products);

    @Delete("DELETE FROM product_id_amount")
    void clearTable();

    @Query("SELECT * FROM product_id_amount")
    List<Product> get();
}

